﻿#include <iostream>

using namespace std;
void Func(int a = 0)
{
	cout << a << endl;
}
int main()
{
	Func(); 	// 没有传参时，使⽤函数指定的缺省参数也就是参数的默认值
	Func(10); 	// 传参时，使⽤指定的实参
	return 0;
}

// 全缺省
void Func1(int a = 10, int b = 20, int c = 30)
{
	cout << "a = " << a << endl;
	cout << "b = " << b << endl;
	cout << "c = " << c << endl << endl;
}
// 半缺省
void Func2(int a, int b = 10, int c = 20)
{
	cout << "a = " << a << endl;
	cout << "b = " << b << endl;
	cout << "c = " << c << endl << endl;
}
int main()
{
	Func1();
	Func1(1);
	Func1(1, 2);
	Func1(1, 2, 3);
	Func2(100);
	Func2(100, 200);
	Func2(100, 200, 300);
	return 0;
}